<%@page import="blancosMikel.controller.beans.informativaBeans"%>
<%@ page language="java"%>
<%@ page session="true"%>
<%@page import="blancosMikel.controller.beans.saldosBeans"%>
<%@page import="blancosMikel.controller.beans.rolesBeans"%>
<%@page import="blancosMikel.controller.beans.usuariosBeans"%>
<%@page import="java.util.ArrayList"%>
<html>
<head>
<link rel='stylesheet' href='CSS/sigaabm.css' type='text/css' />
<link rel='stylesheet' href='CSS/efectos.css' type='text/css' />
<SCRIPT type=text/javascript src="JS/login.js"></SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>BLANCOS MIKEL</title>
</head>
<body>
<form id="volver" action='intranet' method='post'>
	<input type='hidden' name='dispatch' value='3' />
</form>
<div class='menu' align='right'>
		<table width='100%'>
			<td align='left' style='color: white'>SIGAABM</td>
			<td align='right'>
				<ul id='menu'>					
					<li><a href="SEGURIDAD/singOut.jsp">Cerrar Sesion</a></li>
					<li><a href='javascript:;' onclick="document.getElementById('volver').submit();">Volver</a></li>
				</ul>
			</td>
		</table>
	</div>
	<%
		if (request.getSession().getAttribute("sesion") == null) {
			response.sendRedirect("loginErrors");
		}else{
			usuariosBeans usuario = (usuariosBeans) request.getSession().getAttribute("sesion");
			ArrayList<saldosBeans> catPromociones = (ArrayList) request.getAttribute("catPromo");
			informativaBeans info = (informativaBeans)request.getAttribute("infoBean");
	%>
<!-- body -->
<table class="bodyIntranet">
<tr>
	<td width="300">
		<table>
		<tr>
			<td height="150"><img src="IMG/logo.PNG" width="200" height="100" /></td>
		</tr>
		<tr>
			<td height="50"><h5><small>Bienvidenid@</small><br> <br>
								<%
									out.println(usuario.getNombreCompleto());
									out.println("<br>");
									out.println(usuario.getRol());
									out.println("<br>");
									out.println(usuario.getEmail());
									out.println("<br>");
								%>
							</h5>
			</td>
		</tr>
		<tr>
			<td>
				<%
						if (usuario.getRol().equals("Administrador") || usuario.getRol().equals("Root")) {
						%>
							<%@ include file='../menuRoot.jsp' %>
						<% 
						} else {
						%>
							<%@ include file='../menuClientes.jsp' %>
						<%
						}
						%>
			</td>
		</tr>
		</table>
	</td>
	<td align="left">
		<form action="saldosSVR" name="buscu" method="post">
		<input type='hidden' name='dispatch' value='3' />
		<label><h3> Buscar Apartado</h3></label>
		<input name="busqueda" type="text"/>
		<input name="accesar" type="submit" value="Buscar"/>
		</form>
			<table id="customers">
				<tr>
					<th>Id Saldo</th>
					<th>Fecha</th>
					<th>Abono</th>
					<th>Restante</th>
				</tr>
				<%
				if(catPromociones.isEmpty()){
					out.println("No existe ningun apartado por el momento");
				}else{									
					for(saldosBeans bean: catPromociones){
						out.println("<tr class='alt'>");
						out.println("<td>");
						out.println(bean.getId_saldo());
						out.println("</td>");
						out.println("<td>");
						out.println(bean.getFecha());
						out.println("</td>");
						out.println("<td>");
						out.println(bean.getAbono());
						out.println("</td>");
						out.println("<td>");
						out.println(bean.getRestante());
						out.println("</td>");
						out.println("<td align='center'>");
						out.println("<a href='apartados.jsp?id=");
						out.println(bean.getId_apartado());
						out.println("'>");
						out.println("");
					}
				}
						%>
				</table>
				</td>
	</tr>
</table>
<label><h3> Insertar Nuevo Apartado</h3></label>	
<div class="cabFinal" align="center">
	<h4>
		<%
		out.println(info.getCopy());
}
		%>
	</h4>
</div>		
</body>
</html>